package com.atguigu.gmall.feign.cart;

import com.atguigu.gmall.cart.entity.CartInfo;
import com.atguigu.gmall.common.result.Result;
import feign.Request;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Api(tags = "远程调用-购物车")//weball => cartFeign => service-cart
@FeignClient("service-cart")//将要调用的微服务
@RequestMapping("/api/inner/rpc/cart")//路径
public interface CartFeignClient {

    @ApiOperation("添加购物车")
    @GetMapping("/add/{skuId}/{skuNum}")
    public Result addToCart(@PathVariable("skuId") Long skuId, @PathVariable("skuNum") Integer skuNum, Request.Options options);

    @ApiOperation("删除选中的商品")
    @GetMapping("/deleteChecked")
    public Result deleteChecked();

    @ApiOperation("获取所有选中的商品")
    @GetMapping("/checkeds")
    public Result<List<CartInfo>> getChecked();
}
